From: Marco Trevisan (TreviƱo) Date: Mon, 25 Aug 2025 12:35:57 +0000 (+0200) Subject: gdm/authPrompt: Preserve the text when switching entry visibility X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~104^2^2~10 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=8237970566c6368a54e97db61c28f08cf65a1f90;p=gnome-shell.git gdm/authPrompt: Preserve the text when switching entry visibility The text visibility of an auth prompt entry may change dynamically at runtime, in particular when unlocking the screen with the blank screen or with the screen shield visible this is happening: - The user starts typing the PAM credential (may be secret or not) - Under the hood the PAM conversation starts and actually asks user for input - The entry text is not cleared because we use what the user has typed so far as the preemptive secret. - The entry is adjusted to follow the requested PAM text visibility settings. -> This may lead to switching the actual text entry widget in use Now, if the first entry that PAM requires is "ECHO ON", like it may happen in the case in which a visible value is requested, we end up "clearing" what the user as typed instead of preserving the value as pre-filled value. Causing the user typing something wrong instead. To prevent this we need to restore both the text, the cursor position and the selection bounds (in case the use pressed some key [binding]) leading to a position or selection change. Part-of: --- diff --git a/js/gdm/authPrompt.js b/js/gdm/authPrompt.js index b6fdb65e9..b9d35354f 100644 --- a/js/gdm/authPrompt.js +++ b/js/gdm/authPrompt.js @@ -307,6 +307,9 @@ export const AuthPrompt = GObject.registerClass({ this._mainBox.replace_child(this._entry, newEntry); this._entry = newEntry; this._inactiveEntry = inactiveEntry; + + const {text, cursorPosition, selectionBound} = inactiveEntry.clutterText; + this._entry.clutterText.set({text, cursorPosition, selectionBound}); } this._capsLockWarningLabel.visible = secret;